package com.lifeng.disconf;

import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfFileItem;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

/**
 * Created by lifeng on 2018/6/20.
 */
@Service
@Scope("singleton")
@DisconfFile(filename = "app.properties")
public class MySet {
    private String myname;
    private Integer age;
    @DisconfFileItem(name = "my.name", associateField = "myname")
    public String getMyname() {
        return myname;
    }

    public void setMyname(String myname) {
        this.myname = myname;
    }
    @DisconfFileItem(name = "my.age", associateField = "age")
    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getInfo(){
        System.out.println(this.getMyname() +":"+this.getAge()+"=============================");
        return this.getMyname() +":"+this.getAge();
    }
}
